﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Core.IBusiness.IPushModule
{
    /// <summary>
    /// 内容部分实体
    /// </summary>
    public class ContentAndImages
    {
        /// <summary>
        /// 图片部分
        /// </summary>
        public string[] Images { get; set; }

        /// <summary>
        /// 内容部分
        /// </summary>
        public string Content { get; set; }

        /// <summary>
        /// 如果内容过长则截取指定长度
        /// </summary>
        /// <param name="length"></param>
        /// <returns></returns>
        public string GetContentSubStringByLength(int length = 15)
        {

            if (string.IsNullOrWhiteSpace(this.Content))
            {
                return string.Empty;
            }

            if (this.Content.Length > length)
            {
                return this.Content.Substring(0, length);
            }
            else {
                return this.Content;
            }
        }
    }
}
